var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = t("ConfS"),
    r = (function () {
        function t() {
            (this.同一内容展示次数Index = -1), (this.同一内容展示时间Index = -1);
        }
        return (
            (t.prototype.检查超时 = function () {
                new Date().getTime() - this.开始加载时间 > 1e3 * n.DatasManager.广告加载超时时间 &&
                    (this.status = "出错");
            }),
            (t.prototype.检查广告出错再次尝试时间 = function () {
                return (
                    !(new Date().getTime() - this.开始加载时间 < 1e3 * n.DatasManager.广告出错再次尝试时间) ||
                    (console.error("距离上次拉取时间不足 " + n.DatasManager.广告出错再次尝试时间 + "秒"), !1)
                );
            }),
            (t.prototype.init = function (t, e, o) {
                for (var n = [], r = 3; r < arguments.length; r++) n[r - 3] = arguments[r];
                if (o) {
                    if (((this.name = t), (this._create = e), "string" == typeof o)) this.adId = o;
                    else {
                        if (!o.length) return !1;
                        (this.adIds = o),
                            (this.adIdIndex = Math.floor(Math.random() * this.adIds.length)),
                            (this.adId = this.adIds[this.adIdIndex]);
                    }
                    for (var a = 0, i = n; a < i.length; a++) {
                        this[i[a]] = !0;
                    }
                    return !0;
                }
                return !1;
            }),
            (t.prototype._createAd = function () {
                return (
                    this.adIds &&
                        (++this.adIdIndex >= this.adIds.length && (this.adIdIndex = 0),
                        (this.adId = this.adIds[this.adIdIndex])),
                    (this.status = "出错"),
                    (this.ad = this._create(this.adId, this.rule)),
                    this.ad || this.log("_create失败 " + this.ad, !0),
                    this.ad
                );
            }),
            (t.prototype.同一内容展示次数 = function () {
                return n.DatasManager.同一内容展示次数们[
                    this.同一内容展示次数Index < n.DatasManager.同一内容展示次数们.length - 1
                        ? ++this.同一内容展示次数Index
                        : n.DatasManager.同一内容展示次数们.length - 1
                ];
            }),
            (t.prototype.同一内容展示时间 = function () {
                return n.DatasManager.同一内容展示时间们[
                    this.同一内容展示时间Index < n.DatasManager.同一内容展示时间们.length - 1
                        ? ++this.同一内容展示时间Index
                        : n.DatasManager.同一内容展示时间们.length - 1
                ];
            }),
            (t.prototype.展示次数或展示时间达到预定值 = function () {
                if (this.剩余展示次数 > 0 && --this.剩余展示次数 <= 0)
                    return (
                        this.log(
                            "展示次数（" +
                                (this._同一内容展示次数 - this.剩余展示次数) +
                                "）达到预定值（" +
                                this._同一内容展示次数 +
                                "），重新拉取"
                        ),
                        !0
                    );
                if (this.开始加载时间 > 0) {
                    var t = (new Date().getTime() - this.开始加载时间) / 1e3;
                    if (t > this._同一内容展示时间)
                        return (
                            this.log("展示时间（" + t + "秒）达到预定值（" + this._同一内容展示时间 + "），重新拉取"),
                            !0
                        );
                }
                return !1;
            }),
            (t.prototype.log = function (t, e) {
                (e ? console.error : console.log)(
                    this.name +
                        "（" +
                        this.status +
                        "）" +
                        t +
                        " " +
                        (this.adIds ? this.adIdIndex + " " : "") +
                        this.adId
                );
            }),
            t
        );
    })();
o.default = r;
